<template>
  <div>队员注册</div>
</template>

<script setup lang="ts">
import { onLoad } from '@dcloudio/uni-app';
// 接口
import { accessGetToken } from './service';

/**
 * 接口相关
 */
const fetchAccessGetToken = async (params: Partial<{ token: string; invite_code: string }>) => {
  uni.showLoading({
    title: '加载中...',
    mask: true,
  });
  try {
    const res = await accessGetToken({ ...params });
    uni.setStorageSync('outsideToken', res.data.token);
    setTimeout(() => {
      uni.navigateTo({
        url: '/pages/outside-h5/registration?invite_code=' + params.invite_code,
      });
    }, 0);
  } catch (error) {}
  uni.hideLoading();
};

onLoad(option => {
  console.log(option);
  fetchAccessGetToken(option as any);
});
</script>
